<!-- src/templates/invoice.html -->
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <style>
    body { font-family: Arial, sans-serif; margin: 0; padding: 20px; }
    .invoice { max-width: 800px; margin: 0 auto; border: 1px solid #ddd; padding: 30px; }
    .header { text-align: center; margin-bottom: 30px; }
    .details { margin-bottom: 30px; }
    .table { width: 100%; border-collapse: collapse; margin-bottom: 30px; }
    .table th, .table td { border: 1px solid #ddd; padding: 10px; text-align: left; }
    .table th { background-color: #f5f5f5; }
    .total { text-align: right; font-weight: bold; font-size: 18px; }
    .footer { margin-top: 50px; text-align: center; color: #666; }
  </style>
</head>
<body>
  <div class="invoice">
    <div class="header">
      <h1>发票</h1>
      <p>发票号: {{invoiceNumber}}</p>
    </div>
    
    <div class="details">
      <p><strong>日期:</strong> {{date}}</p>
      <p><strong>客户:</strong> {{customerName}}</p>
      <p><strong>地址:</strong> {{customerAddress}}</p>
    </div>
    
    <table class="table">
      <thead>
        <tr>
          <th>项目</th>
          <th>数量</th>
          <th>单价</th>
          <th>总价</th>
        </tr>
      </thead>
      <tbody>
        {{#each items}}
        <tr>
          <td>{{this.name}}</td>
          <td>{{this.quantity}}</td>
          <td>¥{{this.price}}</td>
          <td>¥{{this.total}}</td>
        </tr>
        {{/each}}
      </tbody>
    </table>
    
    <div class="total">
      总计: ¥{{totalAmount}}
    </div>
    
    <div class="footer">
      <p>感谢您的惠顾！</p>
      <p>{{companyName}} - {{companyContact}}</p>
    </div>
  </div>
</body>
</html>
